package com.bmft;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.CompoundButton;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.Toast;

public class RadioButtonActivity07 extends AppCompatActivity {
    RadioButton rb_1_1;
    RadioButton rb_1_2;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_radio_button07);
        //find
        rb_1_1 = findViewById(R.id.rb_1_1);
        rb_1_2 = findViewById(R.id.rb_1_2);
        //set listener.
        rb_1_1.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                CharSequence text = buttonView.getText();
                Toast.makeText(RadioButtonActivity07.this,text,Toast.LENGTH_SHORT).show();
            }
        });
        rb_1_2.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                CharSequence text = buttonView.getText();
                Toast.makeText(RadioButtonActivity07.this,text,Toast.LENGTH_SHORT).show();
            }
        });
    }

    public void radio_button_07_back_to_main(View view) {
        Intent intent = new Intent(RadioButtonActivity07.this, MainActivity.class);
        startActivity(intent);
    }
}